package com.biz.primus.ms.geo.trans;

import com.biz.primus.ms.geo.dao.po.City;
import com.biz.primus.ms.geo.dao.po.District;
import com.biz.primus.ms.geo.dao.po.Province;
import com.biz.primus.ms.geo.dao.ro.CityRo;
import com.biz.primus.ms.geo.dao.ro.DistrictRo;
import com.biz.primus.ms.geo.dao.ro.ProvinceRo;
import com.google.common.base.Function;

/**
 * @author JKLiues
 * @date 2017/11/8
 */
public interface GeoTransformer {

    Province2ProvinceRo PROVINCE_TRANSFORMER = new Province2ProvinceRo();
    City2CityRo CITY_TRANSFORMER = new City2CityRo();
    District2DistrictRo DISTRICT_TRANSFORMER = new District2DistrictRo();

    class Province2ProvinceRo implements Function<Province, ProvinceRo> {
        @Override
        public ProvinceRo apply(Province input) {
            return new ProvinceRo(input);
        }
    }

    class City2CityRo implements Function<City, CityRo> {
        @Override
        public CityRo apply(City input) {
            return new CityRo(input);
        }
    }

    class District2DistrictRo implements Function<District, DistrictRo> {
        @Override
        public DistrictRo apply(District input) {
            return new DistrictRo(input);
        }
    }
}
